package rmi;

import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.UnknownHostException;
import java.rmi.Naming;
import java.rmi.RemoteException;
import java.rmi.registry.LocateRegistry;
import java.rmi.registry.Registry;

import services.OrdenCompraService;
import services.XMLService;
import servicesImpl.OrdenCompraServiceImpl;
import servicesImpl.XMLServiceImpl;

public class ServidorRMI {

	public static void getConexion() throws RemoteException, MalformedURLException, UnknownHostException{
		LocateRegistry.createRegistry(Registry.REGISTRY_PORT);	
	      XMLService XMLService = new XMLServiceImpl();
	      OrdenCompraService ocService = new OrdenCompraServiceImpl();
	      Naming.rebind("//localhost/XMLService", XMLService);
	      Naming.rebind("//localhost/OrdenCompraService", ocService);
	      for(String vinculo : Naming.list("")){
	    	  System.out.print(InetAddress.getLocalHost());
	    	  System.out.println(vinculo);
	      }
	}
}
